#pragma once

#include "GameState.h"
#include "ObjectManager.h"
#include "LevelManager.h"
#include "Pause.h"
#include "LevelCompleteState.h"

#include "Player.h"
#include "ObjectManager.h"
#include "EmitterManager.h"
#include "LevelTimer.h"

// Private forward declarations.
class Camera;

class GamePlayState : public GameState
{
private:

	Pause pauseMenu;
	LevelCompleteState levelCompleteMenu;
	LevelManager levelManager;
	LevelTimer levelTimer;

	int currentLevel;

	ObjectManager* objManager;
	Camera* camera;

	bool isPaused;
	bool isOver;
	float elapsedTime;
	// Instance of the gamestate
	static GamePlayState* pInstance;

	Emitter* e;
	Emitter* e2;

	// Constructor
	GamePlayState(void);

	// Destructor
	~GamePlayState(void);

	//Temp Testing Player
	Player* player;

	//Level Backgrounds
	int ChapterOneImageID;
	int ChapterTwoImageID;
	int ChapterThreeImageID;
	int ChapterFourImageID;
	int ChapterFiveImageID;

	//Current Level
	int CurrentLevel;


public:

	static GamePlayState* GetInstance( void );
	static void DeleteInstance( void );

	////////////////////////////////////////////////////////////////
	// Accessor for the Player because its needed fucking everywhere
	Player* GetPlayer( void ) { return player; }

	LevelManager GetlevelManager(void) {return levelManager;}

	// Mutators
	void SetIsOver(bool over) {isOver = over;}

	///////////////////////////////////////////////////////////////
	// GameState Methods:
	virtual void Update(float deltaTime)	override;
	virtual void Render(void) const			override;
	virtual void Enter(void)				override;
	virtual void Enter(unsigned int level);
	virtual void Exit(void)					override;

	void Unpause() {isPaused = false; pauseMenu.Exit();};
	bool LoadNextLevel(void);
	void ReplayLevel(void);
};

